<!--
 * @Author: zhayang
 * @LastEditors: zhayang 1063975710@qq.com
 * @Date: 2024-06-23 20:11:01
 * @LastEditTime: 2024-06-24 21:42:00
 * @Description: TODO:输入功能描述
-->
<template>
  <div class="fit overflow-auto flex">
    <div class="flex-1">
      <div class="four-title m-b-8">收费方式</div>
      <div>
        <el-radio
          v-model="formState.usage_pay_mode"
          :label="0"
        >
          拥有者付费
        </el-radio>
        <el-radio
          v-model="formState.usage_pay_mode"
          :label="1"
        >
          使用者付费
        </el-radio>
      </div>
    </div>
    <div class="flex-1">
      <div class="four-title m-b-8">单次费用</div>
      <el-input-number
        v-model="formState.user_pay_price"
        controls-position="right"
        :min="0"
        :step="0.1"
        size="small"
        placeholder="请输入"
        :style="{
          width: '100%'
        }"
      />
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      formState: {
        usage_pay_mode: 0,
        user_pay_price: 0
      }
    }
  },
  created() {},
  methods: {
    submit() {
      return new Promise((resolve, reject) => {
        if (this.formState.usage_pay_mode) {
          if (
            this.formState.user_pay_price &&
            this.formState.user_pay_price > 0
          ) {
            resolve({
              ...this.formState
            })
          } else {
            this.$message.warning('使用者付费时单次付费需要大于0')
            reject(false)
          }
        } else {
          resolve({
            ...this.formState
          })
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.four-title {
  font-weight: 400;
  font-size: 14px;
  color: #1c1f23;
  line-height: 22px;
}
</style>
